Skip to main content

com.livecode.unittest

Type

module

Summary

This library provides syntax for unit testing LiveCode Builder programs. It is used by the LiveCode Builder standard library's testsuite.

To use this library, write your tests in a Builder source code file. Each group of tests should be a public handler with a name beginning with Test. If possible, use one test per handler. Otherwise, add a plan N tests statement at the start of the handler.

Description

This library provides syntax for unit testing LiveCode Builder programs. It is used by the LiveCode Builder standard library's testsuite.

To use this library, write your tests in a Builder source code file. Each group of tests should be a public handler with a name beginning with Test. If possible, use one test per handler. Otherwise, add a plan N tests statement at the start of the handler.

Examples

public handler TestSelf()
plan 10 tests

test diagnostic "Normal tests"
test 2 > 1
test "Basic test" when true

test diagnostic "Skipped tests"
skip test
skip test "Skipped 2"
skip test because "Not implemented"
skip test "Skipped 4" because "Not supported on this platform"

test diagnostic "Tests which are expected to fail"
broken test false
broken test "Failed 2" when false
broken test false because "broken"
broken test "Failed 4" when false because "really broken"
end handler

The test results are output on standard output in TAP (Test Anything
Protocol) format.
Thank you for your feedback!

Was this page helpful?